package com.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.dao.UserLogDao;
import com.enetiy.Userlog;

public class UserLogDaoImpl extends HibernateDaoSupport implements UserLogDao {

	@Override
	public Serializable insertUserlog(Userlog ul) throws Exception {
		return this.getHibernateTemplate().save(ul);
	}

	@Override
	public Userlog selectUserlogOne(int users_id) throws Exception {
		Query query = this.getSession().createQuery("from Userlog where users_id=?");
		query.setParameter(0, users_id);
		List<Userlog> list = query.list();
		return list.isEmpty()?null:list.get(0);
	}

}
